import Vue from 'vue'
import Router from 'vue-router'
/* Layout */
import Layout from '@/layout'
Vue.use(Router)

/**
 * Note: 路由配置项
 *
 * hidden: true                   // 当设置 true 的时候该路由不会再侧边栏出现 如401，login等页面，或者如一些编辑页面/edit/1
 * alwaysShow: true               // 当你一个路由下面的 children 声明的路由大于1个时，自动会变成嵌套的模式--如组件页面
 *                                // 只有一个时，会将那个子路由当做根路由显示在侧边栏--如引导页面
 *                                // 若你想不管路由下面的 children 声明的个数都显示你的根路由
 *                                // 你可以设置 alwaysShow: true，这样它就会忽略之前定义的规则，一直显示根路由
 * redirect: noRedirect           // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
 * name:'router-name'             // 设定路由的名字，一定要填写不然使用<keep-alive>时会出现各种问题
 * meta : {
    roles: ['admin','editor']    // 设置该路由进入的权限，支持多个权限叠加
    title: 'title'               // 设置该路由在侧边栏和面包屑中展示的名字
    icon: 'svg-name'             // 设置该路由的图标，对应路径src/icons/svg
    breadcrumb: false            // 如果设置为false，则不会在breadcrumb面包屑中显示
  }
 */

// 公共路由
export const constantRoutes = [

  {

    path: '/biddetail',
    component: (resolve) => require(['@/views/xmgl/biddetail'], resolve),

  },
  {

    path: '/xmjys',
    component: (resolve) => require(['@/views/xmgl/xmxx/spjd/xmjys'], resolve),

  },
  {
    path: '/zbtx',
    component: (resolve) => require(['@/views/xmgl/zbtx'], resolve)
  },
  {
    path: '/sjzx',
    component: (resolve) => require(['@/views/xmgl/sjzx'], resolve)
  },
  {
    path: '/login',
    component: (resolve) => require(['@/views/login'], resolve),
  },

  
  {
    path: '',
    // component: (resolve) => require(['@/views/xmgl/HomeBack'], resolve),
    redirect: '/index',
  },

  {
    path: "/index",
    component: (resolve) => require(['@/views/xmgl/gismap'], resolve)
  },

  {
    path: '/homeback',
    component: (resolve) => require(['@/views/xmgl/HomeBack'], resolve),
    redirect: '/welcome',
    children: [{
        path: '/welcome',
        component: (resolve) => require(['@/views/xmgl/welcome'], resolve),
      },
      {
        path: '/xmjk',
        component: (resolve) => require(['@/views/xmgl/xmjk'], resolve),
      },
      {
        path: '/bid',
        component: (resolve) => require(['@/views/xmgl/bid'], resolve),
      },
      {
        path: '/xmmsg',
        component: (resolve) => require(['@/views/xmgl/xmmsg'], resolve)
      },
      {
        path: '/htzl',
        component: (resolve) => require(['@/views/xmgl/htzl'], resolve)
      },
      {
        path: '/zjzl',
        component: (resolve) => require(['@/views/xmgl/zjzl'], resolve)
      },
      {
        path: '/sszl',
        component: (resolve) => require(['@/views/xmgl/sszl'], resolve)
      },
      {
        path: '/sqgl',
        component: (resolve) => require(['@/views/xmgl/sqgl'], resolve)
      },
      {
        path: '/sjss',
        component: (resolve) => require(['@/views/xmgl/sjss'], resolve)
      },
      {
        path: '/bggl',
        component: (resolve) => require(['@/views/xmgl/bggl'], resolve)
      },
      {
        path: '/xmtj',
        component: (resolve) => require(['@/views/xmgl/xmtj'], resolve)
      },
    ]
  },

  // {
  //   path: "/test",
  //   component: (resolve) => require(['@/views/xmgl/test'], resolve),
  // },
  //测试card组件
  {
    path: '/testcard',
    component: (resolve) => require(['@/views/xmgl/testcard'], resolve),
  },
  //测试search组件
  {
    path: '/search',
    component: (resolve) => require(['@/views/xmgl/search'], resolve),
  },
  //测试map
  {
    path: '/map',
    component: (resolve) => require(['@/views/xmgl/map'], resolve),
  },
  //测试gismap
  {
    path: '/gismap',
    component: (resolve) => require(['@/views/xmgl/gismap'], resolve)
  },

  //测试excel导入导出
  {
    path: '/exports',
    component: (resolve) => require(['@/views/xmgl/testExports'], resolve)
  },
  //测试压缩文件并下载
  {
    path: '/compress',
    component: (resolve) => require(['@/views/xmgl/compress'], resolve)
  },

  //测试日期控件
  {
    path: '/date',
    component: (resolve) => require(['@/views/xmgl/date'], resolve)
  },

  //招标资料管理页面
  {
    path: '/bid',
    component: (resolve) => require(['@/views/xmgl/bid'], resolve)
  },

  {
    path: '/title',
    component: (resolve) => require(['@/components/title/index.vue'], resolve)
  },
  //查询文件个数
  {
    path: '/filenumber',
    component: (resolve) => require(['@/views/filenumber/index.vue'], resolve)
  },
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [{
      path: '/redirect/:path(.*)',
      component: (resolve) => require(['@/views/redirect'], resolve)
    }]
  },

  {
    path: '/me',
    name: 'me',
    component: Layout,
    hidden: true,
    children: [{
        path: '/joinDimension',
        name: 'joinDimension',
        component: (resolve) => require(['@/views/quota/define/joinDimension'], resolve),
        hidden: true,
        meta: {
          title: '关联维度'
        }
      },
      {
        path: '/quota/dimensionReport',
        name: 'dimensionReport',
        component: (resolve) => require(['@/views/quota/dimensionReport/index'], resolve),
        hidden: true,
        meta: {
          title: '报表预览'
        }
      },
      // {
      //   path: '/quota/PivotChart',
      //   name: 'PivotChart',
      //   component: (resolve) => require(['@/views/quota/PivotChart/index'], resolve),
      //   hidden: true,
      //   meta: { title: '报表预览' }
      // },
      {
        path: '/pretreatmentDefine',
        name: 'pretreatmentDefine',
        component: (resolve) => require(['@/views/quota/define/pretreatmentDefine'], resolve),
        hidden: true,
        meta: {
          title: '指标预处理'
        }
      },
      {
        path: '/pretreatmentDimension',
        name: 'pretreatmentDimension',
        component: (resolve) => require(['@/views/quota/define/pretreatmentDimension'], resolve),
        hidden: true,
        meta: {
          title: '维度预处理'
        }
      }
    ]
  },
  {
    path: '/404',
    component: (resolve) => require(['@/views/error/404'], resolve),
    hidden: true
  },
  {
    path: '/401',
    component: (resolve) => require(['@/views/error/401'], resolve),
    hidden: true
  },

  {
    path: '/user',
    component: Layout,
    hidden: true,
    redirect: 'noredirect',
    children: [{
      path: 'profile',
      component: (resolve) => require(['@/views/system/user/profile/index'], resolve),
      name: 'Profile',
      meta: {
        title: '个人中心',
        icon: 'user'
      }
    }]
  },
  {
    path: '/dict',
    component: Layout,
    hidden: true,
    children: [{
      path: 'type/data/:dictId(\\d+)',
      component: (resolve) => require(['@/views/system/dict/data'], resolve),
      name: 'Data',
      meta: {
        title: '字典数据',
        icon: ''
      }
    }]
  },
  {
    path: '/job',
    component: Layout,
    hidden: true,
    children: [{
      path: 'log',
      component: (resolve) => require(['@/views/monitor/job/log'], resolve),
      name: 'JobLog',
      meta: {
        title: '调度日志'
      }
    }]
  },
  {
    path: '/gen',
    component: Layout,
    hidden: true,
    children: [{
      path: 'edit',
      component: (resolve) => require(['@/views/tool/gen/editTable'], resolve),
      name: 'GenEdit',
      meta: {
        title: '修改生成配置'
      }
    }]
  }
]

export default new Router({
  //mode: 'history', // 去掉url中的#
   mode: 'hash', // 去掉url中的# (部署服务器用这个)
  //base: '/dist',
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRoutes
})
